import { faq } from "../../api/faq.js";
const app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    list: [
      {
        name: "使用指南",
        icon: "../../images/customer-icon-1.png",
        url: "/pages/guide/guide",
      },
      { name: "显示未归还", icon: "../../images/customer-icon-2.png", url: "" },
      { name: "计费错误", icon: "../../images/customer-icon-3.png", url: "" },
      { name: "讲解器丢失", icon: "../../images/customer-icon-4.png", url: "" },
    ],
    tabs: faq,
    active: 1,
    activeName: 11,
    service_icon: "../../images/icon-service.png",
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {},
  onChangeTabs(event) {
    this.setData({
      active: event.detail,
      activeName: faq[event.detail.index].child[0].name,
    });
  },
  goToPages(e) {
    const { url } = e.currentTarget.dataset;
    if (url) {
      wx.navigateTo({ url });
    } else {
      this.handleKf();
    }
  },

  onChangeCollapse(event) {
    this.setData({
      activeName: event.detail,
    });
  },
  handleKf() {
    app.handleKf();
  },
  makeCall() {
    wx.makePhoneCall({
      phoneNumber: "400-110-7981", // 替换为实际电话号码
      success() {
        console.log("拨打成功");
      },
      fail(err) {
        console.log("拨打失败", err);
      },
    });
  },
});
